package com.tianze.tzkf.function.leadRecord;

import android.support.annotation.Nullable;
import android.support.constraint.ConstraintLayout;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.tianze.tzkf.R;
import com.tianze.tzkf.bean.OrderListBean;

import java.util.List;

/**
 * Created by Zcyang on 2018/12/28.
 */
public class LeadRecordPayAdapter extends BaseQuickAdapter<OrderListBean.DataBean.ListBean, BaseViewHolder> {


    public LeadRecordPayAdapter(int layoutResId, @Nullable List<OrderListBean.DataBean.ListBean> data) {
        super(layoutResId, data);

    }

    @Override
    protected void convert(BaseViewHolder helper, OrderListBean.DataBean.ListBean item) {


        if (TextUtils.equals("alipay", item.getPay_type())) {
            helper.setImageResource(R.id.iv_pay_type_icon, R.drawable.ali_pay);
        } else if (TextUtils.equals("weixin", item.getPay_type())) {
            helper.setImageResource(R.id.iv_pay_type_icon, R.drawable.wechat_pay);
        } else {
            helper.setImageResource(R.id.iv_pay_type_icon, R.drawable.union_pay);
        }
        int pay_status = item.getPay_status();

        if (pay_status == 1) {
            helper.setText(R.id.tv_pay_type_status, "支付成功");
            helper.setText(R.id.tv_pay_type_amount, "+" + item.getTotal_amount() + "元");

        } else if (pay_status == 4) {
            helper.setText(R.id.tv_pay_type_status, "退款中");
            helper.setText(R.id.tv_pay_type_amount, "-" + item.getTotal_amount() + "元");

        } else if (pay_status == 5) {
            helper.setText(R.id.tv_pay_type_status, "退款成功");
            helper.setText(R.id.tv_pay_type_amount, "-" + item.getTotal_amount() + "元");

        } else if (pay_status == 2) {
            helper.setText(R.id.tv_pay_type_status, "支付失败");
            helper.setText(R.id.tv_pay_type_amount, item.getTotal_amount() + "元");

        } else {
            helper.setText(R.id.tv_pay_type_status, "等待支付");
            helper.setText(R.id.tv_pay_type_amount, "+" + item.getTotal_amount() + "元");

        }


        helper.setText(R.id.tv_pay_type_time, item.getCreated_at());


    }


}
